/*
 * ScrabbleClient.java
 *
 * Created on 19 maart 2008, 20:26
 */
package client.gui;

import client.gui.controls.scrabble.Hokje;
import client.gui.controls.scrabble.Blokje;
import client.gui.controls.scrabble.Vakje;
import client.controllers.ScrabbleController;
import client.gui.Chatroom;
import client.communication.ClientCommunication;
import client.gui.smilies.ISmileyOntvanger;
import client.gui.smilies.SmileyVerwerker;
import client.gui.smilies.smileyPopup;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Hashtable;
import javax.swing.JLabel;
import javax.swing.WindowConstants;
import javax.swing.text.BadLocationException;
import javax.swing.text.StyledDocument;
import org.apache.log4j.Logger;
import data.Gameroom;
import data.Gebruiker;

/**
 *
 * @author  Administrator
 */
public class ScrabbleClient extends javax.swing.JFrame implements ISmileyOntvanger {

    private static Logger logger = Logger.getLogger(ScrabbleClient.class);
    private Gebruiker gebruiker;
    private Chatroom chatroom;
    private Gameroom gameroom;
    private boolean blokjesGelegdVorigeBeurt = false;
    private javax.swing.Timer timer;
    private int tijdOver = 0;
    private smileyPopup smipopup;
    // private String[] omTeRuilenLetters;
    /** Creates new form ScrabbleClient */
    public ScrabbleClient(Gebruiker g, Chatroom chatroom, Gameroom room) {
        this();
        smipopup = new smileyPopup(this);
        ClientCommunication.getInstance().setSpelbord(pnlSpelbord);
        ClientCommunication.getInstance().setScrabbleClient(this);
        this.gebruiker = g;
        this.chatroom = chatroom;
        this.gameroom = room;
        ClientCommunication.getInstance().setPlankje(pnlPlankje);
        ScrabbleController.getInstance().reset();
        this.setTitle("Scrabble spel: welkom " + gebruiker.getNickname() + " in gameroom " + gameroom.getGamenaam() + "!");
        txtChatMessages.setText("-- Welkom in gameroom " + gameroom.getGamenaam() + "! --");
        lblSpelerLijst.setText("<html>Scores:<br/><br/>" + g.getNickname() + ": " + 0 + "<br /></html>");

        //Spel starten knop al dan niet disabled zetten
        toonSpelStartenKnop(gebruiker.getNickname().equals(room.getNicknameOprichter()));
        lblTijd.setVisible(false);
        btnPas.setEnabled(false);
        btnValideer.setEnabled(false);
        btnBlokjesInruilen.setEnabled(false);
    }

    public ScrabbleClient() {
        initComponents();
        this.setSize(650, 650);
        this.setLocationRelativeTo(null);
        this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

        //Droptarget van textveld op null zetten zodat je de blokjes er niet in kan
        //droppen
        txtMessage.setDropTarget(null);
        timer = new javax.swing.Timer(1000, new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                logger.info("timer van speler " + gebruiker.getNickname() + " loopt.");
                tijdOver--;
                changeTime();
            }
        });
    }

    public void toon() {
        this.setVisible(true);
    }

    private void changeTime() {
        lblTijd.setText("Tijd: " + tijdOver + " sec");
        if (tijdOver == 0) {
            verwijderNietGevalideerdeBlokjesVanSpelbord();
            //ClientCommunication.getInstance().geefBeurtDoor();
            ClientCommunication.getInstance().beurtVerlopen(gebruiker.getNickname(), gameroom.getGamenaam());
            showMessage("Uw tijd is om!", Color.BLACK);
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        lblSpelerLijst = new javax.swing.JLabel();
        jPanel5 = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jPanel10 = new javax.swing.JPanel();
        txtAantalInZakje = new javax.swing.JLabel();
        jPanel7 = new javax.swing.JPanel();
        helpLinkLabel1 = new client.gui.controls.HelpLinkLabel();
        btnSpelStarten = new javax.swing.JButton();
        jLabel6 = new javax.swing.JLabel();
        lblTijd = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jPanel8 = new javax.swing.JPanel();
        btnValideer = new javax.swing.JButton();
        jLabel8 = new javax.swing.JLabel();
        btnBlokjesInruilen = new javax.swing.JButton();
        jLabel9 = new javax.swing.JLabel();
        btnPas = new javax.swing.JButton();
        jLabel7 = new javax.swing.JLabel();
        btnShuffle = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        pnlSpelbord = new client.gui.SpelbordScrabble();
        jPanel9 = new javax.swing.JPanel();
        pnlPlankje = new client.gui.controls.scrabble.Plankje();
        lblMessage = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        txtMessage = new javax.swing.JTextField();
        btnVerzend = new javax.swing.JButton();
        btnSmiley = new javax.swing.JToggleButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        txtChatMessages = new client.gui.controls.ColoredTextpane();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Scrabble Client");
        setMinimumSize(new java.awt.Dimension(650, 650));
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });
        addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentResized(java.awt.event.ComponentEvent evt) {
                formComponentResized(evt);
            }
        });
        getContentPane().setLayout(new java.awt.BorderLayout(0, 5));

        jPanel1.setPreferredSize(new java.awt.Dimension(120, 0));
        jPanel1.setLayout(new java.awt.BorderLayout());

        lblSpelerLijst.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        lblSpelerLijst.setBorder(javax.swing.BorderFactory.createEmptyBorder(10, 1, 1, 1));
        lblSpelerLijst.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        lblSpelerLijst.setOpaque(true);
        lblSpelerLijst.setPreferredSize(new java.awt.Dimension(2, 130));
        lblSpelerLijst.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
        jPanel1.add(lblSpelerLijst, java.awt.BorderLayout.NORTH);

        jPanel5.setLayout(new javax.swing.BoxLayout(jPanel5, javax.swing.BoxLayout.PAGE_AXIS));

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 120, Short.MAX_VALUE)
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 418, Short.MAX_VALUE)
        );

        jPanel5.add(jPanel6);

        jLabel1.setText(" ");
        jPanel5.add(jLabel1);

        jPanel10.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 10, 1, 10));
        jPanel10.setLayout(new java.awt.BorderLayout());

        txtAantalInZakje.setText(" ");
        jPanel10.add(txtAantalInZakje, java.awt.BorderLayout.CENTER);

        jPanel5.add(jPanel10);

        jPanel7.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 10, 1, 10));
        jPanel7.setLayout(new java.awt.GridLayout(0, 1));
        jPanel7.add(helpLinkLabel1);

        btnSpelStarten.setText("Start spel");
        btnSpelStarten.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSpelStartenActionPerformed(evt);
            }
        });
        jPanel7.add(btnSpelStarten);
        jPanel7.add(jLabel6);

        lblTijd.setText("jLabel8");
        jPanel7.add(lblTijd);

        jPanel5.add(jPanel7);

        jLabel4.setText(" ");
        jPanel5.add(jLabel4);

        jPanel8.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 10, 1, 10));
        jPanel8.setLayout(new java.awt.GridLayout(0, 1));

        btnValideer.setText("Valideer");
        btnValideer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnValideerActionPerformed(evt);
            }
        });
        jPanel8.add(btnValideer);

        jLabel8.setText(" ");
        jPanel8.add(jLabel8);

        btnBlokjesInruilen.setText("Inruilen...");
        btnBlokjesInruilen.setToolTipText("<html>Selecteer de blokjes die u wil inruilen en klik op deze knop. <br />\nWanneer deze knop uitgeschakeld is betekent het dat u geen blokjes kan inruilen</html>");
        btnBlokjesInruilen.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBlokjesInruilenActionPerformed(evt);
            }
        });
        jPanel8.add(btnBlokjesInruilen);

        jLabel9.setText(" ");
        jPanel8.add(jLabel9);

        btnPas.setText("Pas");
        btnPas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPasActionPerformed(evt);
            }
        });
        jPanel8.add(btnPas);

        jLabel7.setText(" ");
        jPanel8.add(jLabel7);

        btnShuffle.setText("Shuffle");
        btnShuffle.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnShuffleActionPerformed(evt);
            }
        });
        jPanel8.add(btnShuffle);

        jPanel5.add(jPanel8);

        jPanel1.add(jPanel5, java.awt.BorderLayout.CENTER);

        getContentPane().add(jPanel1, java.awt.BorderLayout.LINE_END);

        jPanel2.setLayout(new java.awt.BorderLayout(0, 5));
        jPanel2.add(pnlSpelbord, java.awt.BorderLayout.CENTER);

        jPanel9.setLayout(new java.awt.BorderLayout());

        pnlPlankje.setMaximumSize(new java.awt.Dimension(32767, 40));
        pnlPlankje.setMinimumSize(new java.awt.Dimension(402, 30));
        pnlPlankje.setPreferredSize(new java.awt.Dimension(650, 35));
        jPanel9.add(pnlPlankje, java.awt.BorderLayout.CENTER);

        lblMessage.setFont(new java.awt.Font("Tahoma", 1, 12));
        lblMessage.setText(" ");
        lblMessage.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 5, 1));
        jPanel9.add(lblMessage, java.awt.BorderLayout.PAGE_START);

        jPanel2.add(jPanel9, java.awt.BorderLayout.PAGE_END);

        getContentPane().add(jPanel2, java.awt.BorderLayout.CENTER);

        jPanel3.setLayout(new java.awt.BorderLayout());

        jPanel4.setLayout(new javax.swing.BoxLayout(jPanel4, javax.swing.BoxLayout.LINE_AXIS));

        txtMessage.setText("Type your message here");
        txtMessage.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                txtMessageKeyPressed(evt);
            }
        });
        jPanel4.add(txtMessage);

        btnVerzend.setText("Verzend");
        btnVerzend.setMargin(new java.awt.Insets(5, 14, 5, 14));
        btnVerzend.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnVerzendActionPerformed(evt);
            }
        });
        jPanel4.add(btnVerzend);

        btnSmiley.setIcon(new javax.swing.ImageIcon(getClass().getResource("/client/gui/smilies/images/1_grin.gif"))); // NOI18N
        btnSmiley.setMargin(new java.awt.Insets(5, 5, 5, 5));
        btnSmiley.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSmileyActionPerformed(evt);
            }
        });
        jPanel4.add(btnSmiley);

        jPanel3.add(jPanel4, java.awt.BorderLayout.SOUTH);

        jScrollPane2.setMaximumSize(new java.awt.Dimension(32767, 70));
        jScrollPane2.setMinimumSize(new java.awt.Dimension(23, 70));
        jScrollPane2.setPreferredSize(new java.awt.Dimension(875, 70));

        txtChatMessages.setEditable(false);
        txtChatMessages.setMaximumSize(new java.awt.Dimension(2147483647, 30));
        txtChatMessages.setMinimumSize(new java.awt.Dimension(6, 30));
        jScrollPane2.setViewportView(txtChatMessages);

        jPanel3.add(jScrollPane2, java.awt.BorderLayout.PAGE_START);

        getContentPane().add(jPanel3, java.awt.BorderLayout.SOUTH);

        pack();
    }// </editor-fold>//GEN-END:initComponents
    private void btnValideerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnValideerActionPerformed
        // TODO add your handling code here:
        //code nog schrijven voor wanneer er maar 1 blokje gelegd is
        logger.info("De gevonden woorden zijn:");
        ArrayList<String> woorden = ScrabbleController.getInstance().valideerVakjes();
        //hier moet de client com aangesproken worden voor de woorden door te sturen naar de server
        ClientCommunication.getInstance().zendGelegdeWoorden(getGebruiker().getNickname(), getGameroom().getGamenaam(), woorden, ScrabbleController.getInstance().getTotaleScoreZet());
        if (woorden != null) {
            for (String sWoord : woorden) {
                logger.info(sWoord);
            }
        }
        //max aantal blokjes nemen
        //de overschot van de blokjes wordt in de methode plaatsblokjes terug
        //gegeven aan de scrabblecontroller
        //pnlPlankje.plaatsBlokjes(BlokjesVerdeler.getInstance().geefblokjes(7));
        int aantalNodigeBlokjes = pnlPlankje.getMaxAantalBlokjes() - pnlPlankje.getAantalBlokjes();
        vraagBlokjesAan(aantalNodigeBlokjes, getGebruiker().getNickname(), getGameroom().getGamenaam());
        
        
}//GEN-LAST:event_btnValideerActionPerformed

    public void vraagBlokjesAan(int aantal, String nickname, String gameName) {
        //Plankje opvullen met blokjes
        //enkel als het spel gestart is
        if (getGameroom().isSpelGestart()) {
            ClientCommunication.getInstance().aanvraagLetters(aantal, nickname, gameName);
        }
    }

    private void formComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentResized
        // TODO add your handling code here:
        pnlPlankje.setPreferredSize(new Dimension(pnlSpelbord.getWidth(), pnlSpelbord.getHeight() / 15));

        int height = this.getHeight();
        this.setSize(height, height);
        this.setLocationRelativeTo(null);
    }//GEN-LAST:event_formComponentResized

    private void btnVerzendActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        verzendBericht();
    }

    private void verzendBericht() {
        if (txtMessage.getText().trim().length() > 0) {
            ClientCommunication.getInstance().zendInGameChatBericht(getGebruiker().getNickname(), getGameroom().getGamenaam(), txtMessage.getText());
            toonBerichtInChatVenster(">> " + getGebruiker().getNickname() + " says: " + txtMessage.getText(), false);
            txtMessage.setText("");
        }
    }

    public void enableKnoppen(boolean enable) {
        if (gameroom.isSpelGestart()) {
            btnValideer.setEnabled(enable);
            btnBlokjesInruilen.setEnabled(enable);
            btnPas.setEnabled(enable);

            Hokje[][] hokjes = pnlSpelbord.getHokjes();

            for (int i = 0; i < hokjes.length; i++) {
                for (int j = 0; j < hokjes.length; j++) {
                    if (hokjes[i][j].getVakjeOfBlokje() instanceof Vakje) {
                        Vakje v = (Vakje) (hokjes[i][j].getVakjeOfBlokje());
                        v.setEnableDrop(enable);
                    }
                }
            }
        }
    }
    
    public void disableChatten(){
        txtChatMessages.setEnabled(false);
        txtMessage.setEnabled(false);
        btnVerzend.setEnabled(false);
        btnSmiley.setEnabled(false);
    }

    public void printAantalBlokjesInZakje(int aantal) {
        if (aantal == 0) {
            txtAantalInZakje.setText("<html>Aantal blokjes resterend in zakje: <span style='color:red;'>" + aantal + "</span></html>");
        }else{
            txtAantalInZakje.setText("<html>Aantal blokjes resterend in zakje: " + aantal + "</html>");
            if(aantal < 16){
                btnBlokjesInruilen.setEnabled(false);
                btnBlokjesInruilen.setToolTipText("<html>Wanneer er minder dan 16 blokjes in het zakje over zijn <br />mag er niet meer geruild worden</html>");
            }
        }
    }

    public void showMessage(String bericht, Color c) {
        lblMessage.setForeground(c);
        lblMessage.setText(bericht);
    }

    public void toonBerichtInChatVenster(String bericht, boolean fromServer) {
        //Berichten van de server in het rood tonen
        if (fromServer) {
            txtChatMessages.append("\n" + bericht, Color.RED);
        } else {
            txtChatMessages.append("\n" + bericht, Color.BLACK);
        }

        //Textveld laten scrollen
        txtChatMessages.setCaretPosition(txtChatMessages.getDocument().getLength() - 1);
        try {
            StyledDocument doc = txtChatMessages.getStyledDocument();
            String text = doc.getText(0, doc.getLength());
            String path = "/client/gui/smilies/images/";
            SmileyVerwerker.parseSmileys(path, doc, text, bericht.length());
            txtChatMessages.setStyledDocument(doc);
        } catch (BadLocationException exc) {
            logger.error("Smilies file: Bad Location");
            logger.error(exc.getMessage());
        }

    }

    public void updateScoreLijst(Hashtable<String, Integer> scores) {
        String lijst = "<html>Scores:<br/><br/>";
        for (String nickname : scores.keySet()) {
            lijst += nickname + ": " + scores.get(nickname).intValue() + "<br/>";
        }
        lijst += "</html>";
        lblSpelerLijst.setText(lijst);

    }

    private void btnShuffleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnShuffleActionPerformed
        // TODO add your handling code here:
        pnlPlankje.shuffleLetters();
}//GEN-LAST:event_btnShuffleActionPerformed

    private void txtMessageKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtMessageKeyPressed
        // TODO add your handling code here:
        //wanneer er op enter geklikt wordt, bericht verzenden
        if (evt.getKeyCode() == 10) {
            verzendBericht();
        }
    }//GEN-LAST:event_txtMessageKeyPressed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        verwijderNietGevalideerdeBlokjesVanSpelbord();
        ClientCommunication.getInstance().leaveGame(getGebruiker().getNickname(), getGameroom().getGamenaam());

        //Bij het afsluiten van de ScrabbleClient, terug de chatroom zichtbaar zetten
        chatroom.setVisible(true);
        chatroom.toFront();
        this.dispose();
    }//GEN-LAST:event_formWindowClosing

    private void btnBlokjesInruilenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBlokjesInruilenActionPerformed
        verwijderNietGevalideerdeBlokjesVanSpelbord();

        BlokjesInruiler inruiler = new BlokjesInruiler(pnlPlankje.getBlokjes(), this);
        inruiler.toon();
    
     
}//GEN-LAST:event_btnBlokjesInruilenActionPerformed

    public void verwijderNietGevalideerdeBlokjesVanSpelbord() {
        //eerst alle blokjes van het spelbord halen en deze terug op het plankje plaatsen
        for (Point p : ScrabbleController.getInstance().getBezetteVakjes().keySet()) {
            JLabel label = ScrabbleController.getInstance().getBezetteVakjes().get(p).getVakjeOfBlokje();

            if (label instanceof Blokje) {
                Blokje b = (Blokje) label;
                pnlPlankje.plaatsBlokje(b);
                pnlSpelbord.getHokjes()[p.x][p.y].setVakjeOfBlokje(pnlSpelbord.getHokjes()[p.x][p.y].getVakje());
                ClientCommunication.getInstance().verplaatsBlokjeOpSpelbord(new Point(-1, -1), p, b.getLetter(), b.isBlancoBlokje(), gameroom.getGamenaam());
            }
        }
    }

    public void veranderOprichterSpel(String nieuweOprichter) {
        getGameroom().setNicknameOprichter(nieuweOprichter);

        //Knop spel starten zichtbaar stellen als je zelf de nieuwe oprichter bent
        if (gebruiker.getNickname().equals(nieuweOprichter)) {
            toonSpelStartenKnop(true);
        }
    }

    public void toonSpelStartenKnop(boolean toon) {
        btnSpelStarten.setVisible(toon);
        btnSpelStarten.setEnabled(!gameroom.isSpelGestart());
    }

    public void setSpelGestart(boolean gestart) {
        getGameroom().setSpelGestart(gestart);
    }

    public void startTimer() {
        tijdOver = gameroom.getTijdPerBeurtInSeconden();
        changeTime();
        lblTijd.setVisible(true);
        timer.start();
    }

    public void stopTimer() {
        lblTijd.setVisible(false);
        timer.stop();
    }

    private void btnSpelStartenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSpelStartenActionPerformed
        // TODO add your handling code here:
        ClientCommunication.getInstance().startSpel(getGameroom().getGamenaam());
        btnSpelStarten.setEnabled(false);
        ClientCommunication.getInstance().setAanDeBeurt(true);
    }//GEN-LAST:event_btnSpelStartenActionPerformed

    public void addSmileyToTextField(String s) {
        txtMessage.setText(txtMessage.getText() + s);
    }

    private void btnPasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPasActionPerformed
        // TODO add your handling code here:
        verwijderNietGevalideerdeBlokjesVanSpelbord();

        ClientCommunication.getInstance().pasBeurt(gebruiker.getNickname(), gameroom.getGamenaam());
}//GEN-LAST:event_btnPasActionPerformed

    private void btnSmileyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSmileyActionPerformed
        // TODO add your handling code here:
        smipopup.show(btnSmiley,-(int)smipopup.getPreferredSize().getWidth() + btnSmiley.getWidth(),-(int)smipopup.getPreferredSize().getHeight() + btnSmiley.getHeight());
    }//GEN-LAST:event_btnSmileyActionPerformed
    /**
     * @param args the command line arguments
     */
    /*public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new ScrabbleClient().setVisible(true);
    }
    });
    }*/
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnBlokjesInruilen;
    private javax.swing.JButton btnPas;
    private javax.swing.JButton btnShuffle;
    private javax.swing.JToggleButton btnSmiley;
    private javax.swing.JButton btnSpelStarten;
    private javax.swing.JButton btnValideer;
    private javax.swing.JButton btnVerzend;
    private client.gui.controls.HelpLinkLabel helpLinkLabel1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JLabel lblMessage;
    private javax.swing.JLabel lblSpelerLijst;
    private javax.swing.JLabel lblTijd;
    private client.gui.controls.scrabble.Plankje pnlPlankje;
    private client.gui.SpelbordScrabble pnlSpelbord;
    private javax.swing.JLabel txtAantalInZakje;
    private client.gui.controls.ColoredTextpane txtChatMessages;
    private javax.swing.JTextField txtMessage;
    // End of variables declaration//GEN-END:variables
    public boolean isBlokjesGelegdVorigeBeurt() {
        return blokjesGelegdVorigeBeurt;
    }

    public void setBlokjesGelegdVorigeBeurt(boolean blokjesGelegdVorigeBeurt) {
        this.blokjesGelegdVorigeBeurt = blokjesGelegdVorigeBeurt;
    }

    public Gebruiker getGebruiker() {
        return gebruiker;
    }

    public void setGebruiker(Gebruiker gebruiker) {
        this.gebruiker = gebruiker;
    }

    public Gameroom getGameroom() {
        return gameroom;
    }

    public void unToggleSmileyButton() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    /* public String[] getOmTeRuilenLetters() {
    return omTeRuilenLetters;
    }
    public void setOmTeRuilenLetters(String[] omTeRuilenLetters) {
    this.omTeRuilenLetters = omTeRuilenLetters;
    if(omTeRuilenLetters.length > 0){
    }
    }*/
}
